﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jim.K3Cloud;

public interface IK3CloudOperationRequest
{
    string FormId { get; set; }
    /// <summary>
    /// 创建者组织内码（非必录）
    /// </summary>
    int CreateOrgId { get; set; }
    /// <summary>
    /// 单据编码集合，数组类型，格式：[No1,No2,...]（使用编码时必录）
    /// </summary>
    string[] Numbers { get; set; }
    /// <summary>
    /// 单据内码集合，字符串类型，格式："Id1,Id2,..."（使用内码时必录）
    /// </summary>
    string Ids { get; set; }
    /// <summary>
    /// 单据内码与分录内码对应关系的集合，字符串类型，格式：[{"Id":"Id1","EntryIds":"EntryId1,EntryId2,..."}] (使用分录状态转换时必录)
    /// </summary>
    string PkEntryIds { get; set; }
    /// <summary>
    /// 是否启用网控，布尔类型，默认false（非必录）
    /// </summary>
    bool NetworkCtrl { get; set; }
    /// <summary>
    /// 否允许忽略交互，布尔类型，默认true（非必录）
    /// </summary>
    bool IgnoreInterationFlag { get; set; }
}


public abstract class K3CloudOperationRequest<T> : ISdkRequest<T>, IK3CloudOperationRequest, IK3CloudCustomRequest where T : ISdkResponse
{
    public string FormId { get; set; }
    /// <summary>
    /// 创建者组织内码（非必录）
    /// </summary>
    public int CreateOrgId { get; set; }
    /// <summary>
    /// 单据编码集合，数组类型，格式：[No1,No2,...]（使用编码时必录）
    /// </summary>
    public string[] Numbers { get; set; }
    /// <summary>
    /// 单据内码集合，字符串类型，格式："Id1,Id2,..."（使用内码时必录）
    /// </summary>
    public string Ids { get; set; }
    /// <summary>
    /// 单据内码与分录内码对应关系的集合，字符串类型，格式：[{"Id":"Id1","EntryIds":"EntryId1,EntryId2,..."}] (使用分录状态转换时必录)
    /// </summary>
    public string PkEntryIds { get; set; }
    /// <summary>
    /// 是否启用网控，布尔类型，默认false（非必录）
    /// </summary>
    public bool NetworkCtrl { get; set; }
    /// <summary>
    /// 否允许忽略交互，布尔类型，默认true（非必录）
    /// </summary>
    public bool IgnoreInterationFlag { get; set; } = true;

    public object QueryParams()
    {
        return new
        {
            FormId = FormId,
            Data = new
            {
                CreateOrgId = CreateOrgId,
                Numbers = Numbers,
                Ids = Ids,
                PkEntryIds = PkEntryIds,
                NetworkCtrl = NetworkCtrl,
                IgnoreInterationFlag = IgnoreInterationFlag
            }
        };
    }

    public abstract void Validate();
}


/// <summary>
/// 作废????
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Cancel", "作废????")]
public class K3CloudCancelRequest : K3CloudOperationRequest<K3CloudCancelResponse>
{
    public override void Validate(){}
}

public class K3CloudCancelResponse : SdkResponse<object> { }

/// <summary>
/// 整单关闭
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.BillClose", "整单关闭")]
public class K3CloudBillCloseRequest : K3CloudOperationRequest<K3CloudBillCloseResponse>
{
    public override void Validate() { }
}

public class K3CloudBillCloseResponse : SdkResponse { }

/// <summary>
/// 整单反关闭
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.UnBillClose", "整单反关闭")]
public class K3CloudUnBillCloseBaseRequest : K3CloudOperationRequest<K3CloudUnBillCloseBaseResponse>
{

    public override void Validate()
    {
    }
}
public class K3CloudUnBillCloseBaseResponse : SdkResponse { }

/// <summary>
/// 业务终止
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Terminate", "业务终止")]
public class K3CloudTerminateBaseRequest : K3CloudOperationRequest<K3CloudTerminateBaseResponse>
{

    public override void Validate()
    {
    }
}

public class K3CloudTerminateBaseResponse:SdkResponse { }

/// <summary>
/// 反业务终止
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.UnTerminate", "反业务终止")]
public class K3CloudUnTerminateBaseRequest : K3CloudOperationRequest<K3CloudUnTerminateBaseResponse>
{
    public override void Validate()
    {
    }
}

public class K3CloudUnTerminateBaseResponse : SdkResponse { }

/// <summary>
/// 业务冻结
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Freeze", "业务冻结")]
public class K3CloudFreezeBaseRequest : K3CloudOperationRequest<K3CloudFreezeBaseResponse>
{
    public override void Validate()
    {
    }
}

public class K3CloudFreezeBaseResponse : SdkResponse { }

/// <summary>
/// 反业务冻结
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.UnFreeze", "反业务冻结")]
public class K3CloudUnFreezeBaseRequest : K3CloudOperationRequest<K3CloudUnFreezeBaseResponse>
{
    public override void Validate()
    {
    }
}
public class K3CloudUnFreezeBaseResponse : SdkResponse { }
/// <summary>
/// 业务关闭
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.MRPClose", "业务关闭")]
public class K3CloudMRPCloseBaseRequest : K3CloudOperationRequest<K3CloudMRPCloseBaseResponse>
{
    public override void Validate()
    {
    }
}
public class K3CloudMRPCloseBaseResponse : SdkResponse { }
/// <summary>
/// 业务反关闭
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.UnMRP", "业务反关闭")]
public class K3CloudUnMRPCloseBaseRequest : K3CloudOperationRequest<K3CloudUnMRPCloseBaseResponse>
{
    public override void Validate()
    {
    }
}
public class K3CloudUnMRPCloseBaseResponse : SdkResponse { }
/// <summary>
/// 工作流信用检查
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.StatusConvert", "工作流信用检查")]
public class K3CloudStatusConvertBaseRequest : K3CloudOperationRequest<K3CloudStatusConvertBaseResponse>
{
    public override void Validate()
    {
    }
}
public class K3CloudStatusConvertBaseResponse : SdkResponse { }
/// <summary>
/// 审批流信用押批和月结控制
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.MonAndPreBatchControl", "审批流信用押批和月结控制")]
public class K3CloudMonAndPreBatchControlBaseRequest : K3CloudOperationRequest<K3CloudMonAndPreBatchControlBaseResponse>
{
    public override void Validate()
    {
    }
}
public class K3CloudMonAndPreBatchControlBaseResponse : SdkResponse { }
/// <summary>
/// 禁用
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Forbid", "禁用")]
public class K3CloudForbidBaseRequest : K3CloudOperationRequest<K3CloudForbidBaseResponse>
{
    public override void Validate()
    {
    }
}
public class K3CloudForbidBaseResponse : SdkResponse { }
/// <summary>
/// 反禁用
/// </summary>
[Sdk("Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Enable", "反禁用")]
public class K3CloudEnableBaseRequest : K3CloudOperationRequest<K3CloudEnableBaseResponse>
{
    public override void Validate()
    {
    }
}

public class K3CloudEnableBaseResponse : SdkResponse { }